import 'package:json_annotation/json_annotation.dart';

part 'room_list_model.g.dart';

@JsonSerializable()
class RoomListModel {
  final Banner? banner;
  final List<Recommend>? recommend;

  const RoomListModel({
    this.banner,
    this.recommend,
  });

  factory RoomListModel.fromJson(Map<String, dynamic> json) =>
      _$RoomListModelFromJson(json);

  Map<String, dynamic> toJson() => _$RoomListModelToJson(this);
}

@JsonSerializable()
class Banner {
  final List<TopBanners>? topBanners;
  final List<dynamic>? listBanners;
  final Background? background;

  const Banner({
    this.topBanners,
    this.listBanners,
    this.background,
  });

  factory Banner.fromJson(Map<String, dynamic> json) => _$BannerFromJson(json);

  Map<String, dynamic> toJson() => _$BannerToJson(this);
}

@JsonSerializable()
class TopBanners {
  final int? id;
  final bool? disable;
  final int? sort;
  final int? operatorId;
  final String? operatorName;
  final int? platformType;
  final int? primaryType;
  final int? pushType;
  final String? topBarColor;
  final String? topBarMode;
  final String? picUrl;
  final int? redirectType;
  final String? redirectUrl;
  final String? createTime;
  final String? updateTime;
  final String? startTime;
  final int? showType;
  final String? dynamicUrl;
  final int? appType;

  const TopBanners({
    this.id,
    this.disable,
    this.sort,
    this.operatorId,
    this.operatorName,
    this.platformType,
    this.primaryType,
    this.pushType,
    this.topBarColor,
    this.topBarMode,
    this.picUrl,
    this.redirectType,
    this.redirectUrl,
    this.createTime,
    this.updateTime,
    this.startTime,
    this.showType,
    this.dynamicUrl,
    this.appType,
  });

  factory TopBanners.fromJson(Map<String, dynamic> json) =>
      _$TopBannersFromJson(json);

  Map<String, dynamic> toJson() => _$TopBannersToJson(this);
}

@JsonSerializable()
class Background {
  final int? id;
  final bool? disable;
  final int? sort;
  final int? operatorId;
  final String? operatorName;
  final int? platformType;
  final int? primaryType;
  final int? pushType;
  final String? topBarColor;
  final String? topBarMode;
  final String? picUrl;
  final int? redirectType;
  final String? createTime;
  final String? updateTime;
  final String? startTime;
  final int? showType;
  final int? appType;

  const Background({
    this.id,
    this.disable,
    this.sort,
    this.operatorId,
    this.operatorName,
    this.platformType,
    this.primaryType,
    this.pushType,
    this.topBarColor,
    this.topBarMode,
    this.picUrl,
    this.redirectType,
    this.createTime,
    this.updateTime,
    this.startTime,
    this.showType,
    this.appType,
  });

  factory Background.fromJson(Map<String, dynamic> json) =>
      _$BackgroundFromJson(json);

  Map<String, dynamic> toJson() => _$BackgroundToJson(this);
}

@JsonSerializable()
class Recommend {
  final String? roomNo;
  final String? roomCode;
  final String? roomName;
  final String? slogan;
  final String? roomIcon;
  final int? roomCategoryId;
  final String? roomCategoryName;
  final String? roomCategoryColor;
  final String? categoryTypeIcon;
  final int? scoreWeight;
  final List<dynamic>? roomInfoTagList;
  final List<dynamic>? micList;
  final String? roomHonorTag;
  final bool? isActivate;
  final bool? isLock;
  final int? hostUserId;
  final int? pkType;
  final int? roomStatus;
  final String? bgImg;
  final String? rightTopIcon;
  final int? realPeople;
  final String? playImg;
  final String? secondCategoryImg;
  final String? secondPlayImg;
  final int? maleCount;
  final int? ladyCount;
  final String? freeShow;
  final String? hotRoomIcon;
  final int? roomTemplateId;
  final String? country;
  final String? countryUrl;
  final String? backgroundUrl;

  // 根据此字段判断是否需要带type
  final String? rangeTypeStr;

  const Recommend({
    this.roomNo,
    this.roomCode,
    this.roomName,
    this.slogan,
    this.roomIcon,
    this.roomCategoryId,
    this.roomCategoryName,
    this.roomCategoryColor,
    this.categoryTypeIcon,
    this.scoreWeight,
    this.roomInfoTagList,
    this.roomHonorTag,
    this.isActivate,
    this.isLock,
    this.hostUserId,
    this.pkType,
    this.roomStatus,
    this.bgImg,
    this.rightTopIcon,
    this.realPeople,
    this.playImg,
    this.secondCategoryImg,
    this.secondPlayImg,
    this.maleCount,
    this.ladyCount,
    this.freeShow,
    this.hotRoomIcon,
    this.roomTemplateId,
    this.country,
    this.countryUrl,
    this.backgroundUrl,
    this.rangeTypeStr,
    this.micList,
  });

  factory Recommend.fromJson(Map<String, dynamic> json) =>
      _$RecommendFromJson(json);

  Map<String, dynamic> toJson() => _$RecommendToJson(this);
}


@JsonSerializable()
class MicList {
  final int index;
  final int maskedIndex;
  final int status;
  final String micUser;
  final int pkMicStatus;
  final String micName;
  final String emblem;
  final String changeTime;
  final String roomNo;

  const MicList({
    required this.index,
    required this.maskedIndex,
    required this.status,
    required this.micUser,
    required this.pkMicStatus,
    required this.micName,
    required this.emblem,
    required this.changeTime,
    required this.roomNo,
  });

  factory MicList.fromJson(Map<String, dynamic> json) =>
      _$MicListFromJson(json);

  Map<String, dynamic> toJson() => _$MicListToJson(this);
}
